package ru.papergames.common.netutils;

import ru.papergames.common.form.AbstractPlayerForm;
import ru.papergames.common.form.PcPlayerForm;

import java.nio.ByteBuffer;

/**
 * User: troshanin
 * Date: 15.01.2011
 * Time: 0:50:21
 */
public class ModelWriterUtils extends BaseBufferUtils {

    public static void writePlayerToBuffer(ByteBuffer buffer, AbstractPlayerForm player) {
        writeBool(buffer, player instanceof PcPlayerForm);
        writeLong(buffer, player.getId());
        writeString(buffer, player.getUsername());
        writeShort(buffer, player.getLevel());
    }
}
